<script setup>
defineProps({
  title: {
    type: String,
    default: '',
  },
  content: {
    type: String,
    default: '',
  },
  img: {
    type: String,
    default: '',
  },
  publishTime: {
    type: String,
    default: '',
  },
  
    link: {
      type: String,
      default: '',
    },
  views: {
    type: Number,
    default: 0,
  }
})
</script>
<template>
  <a :href="link" class="portfolio-card">
    <div class="card-glow"></div>
    <div class="card-content">
      <div class="card-header">
        <img :src="img" :alt="title" class="card-avatar" />
        <div class="card-title-area">
          <h3 class="card-title">{{ title }}</h3>
        </div>
      </div>
      <div class="card-body">
        <p class="card-description">{{ content }}</p>
      </div>
      <div class="card-footer">
        <div class="card-stats">
          <span class="stat-item">
            <i class="icon-eye"></i>
            {{ views }}
          </span>
          <span class="stat-item">
            <i class="icon-calendar"></i>
            {{ publishTime }}
          </span>
        </div>
      </div>
    </div>
  </a>
</template>
<style scoped>
.portfolio-card {
  text-decoration: none;
  color: inherit;
  display: block;
  position: relative;
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 1px solid rgba(255, 255, 255, 0.2);
  width: 100%; /* 确保占满父容器宽度 */
  min-height: 200px; /* 设置最小高度，确保内容少时也有足够高度 */
}

.portfolio-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #f9ca24);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.portfolio-card:hover .card-glow {
  opacity: 0.1;
}

.card-content {
  position: relative;
  z-index: 2;
  padding: 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.card-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
}

.portfolio-card:hover .card-avatar {
  transform: scale(1.1) rotate(5deg);
}

.card-title-area {
  flex: 1;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #2c3e50;
  margin: 0 0 4px 0;
  line-height: 1.3;
}

.card-subtitle {
  font-size: 0.875rem;
  color: #7f8c8d;
  margin: 0;
  font-weight: 500;
}

.card-body {
  flex: 1;
  margin-bottom: 20px;
}

.card-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #34495e;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #ecf0f1;
}

.card-stats {
  display: flex;
  gap: 16px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: #7f8c8d;
  font-weight: 500;
}

.stat-item i {
  font-style: normal;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-eye::before {
  content: '👁';
}

.icon-calendar::before {
  content: '📅';
}

/* 彩虹光晕效果 */
.portfolio-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #f9ca24, #f0932b, #eb4d4b);
  border-radius: 18px;
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
  animation: rainbow-glow 3s linear infinite;
}

.portfolio-card:hover::before {
  opacity: 0.7;
}

@keyframes rainbow-glow {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .card-content {
    padding: 20px;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .card-description {
    font-size: 0.9rem;
  }
}
</style>
